include ../Makefile.config

CXXINCLUDES = ${INCLUDES} ${MPIINCLUDE}

FILEDIRS =\
 ${CURDIR}/../base\
 ${CURDIR}\
 ${CURDIR}/csrMatrix\
 ${CURDIR}/../../3rdParty/unatpp/include\


CXX_COMPILE_FLAGS =\
 $(patsubst %,-I%,$(FILEDIRS))\
 ${CINCLUDES}

HEADERS=$(foreach dir, $(FILEDIRS) , $(wildcard $(dir)/*.hpp) $(wildcard $(dir)/*.h))


FILES =\
 csrMatrix/sparseMatrix.cpp \
 csrMatrix/csrMatrix.cpp 



COBJS = ${FILES:.cpp=.o}
OBJS = ${COBJS}

SONAME = libUNAP_matrix-${LIB_SUFFIX}

##################################################################
# Targets
##################################################################

all: libUNAP_matrix${LIB_SUFFIX}

install: libUNAP_matrix${LIB_SUFFIX}

clean:
	rm -f ${OBJS}
	rm -f *.o *.obj libUNAP*

distclean: clean

##################################################################
# Rules
##################################################################

libUNAP_matrix.a: ${OBJS}
	@echo  "Building $@ ... "
	${AR} $@ ${OBJS}
	${RANLIB} $@
	cp ${HEADERS} ${INSTALL_DIR}/include

libUNAP_matrix.so libUNAP_matrix.dylib: ${OBJS}
	@echo  "Building $@ ... "
	${BUILD_CC_SHARED} -o ${SONAME} ${OBJS} ${SHARED_SET_SONAME}${SONAME}
	ln -s -f ${SONAME} $@
	cp ${HEADERS} ${INSTALL_DIR}/include
